import Vue from 'vue'
import Router from 'vue-router'
import Hello from '@/components/Hello'
import Home from '@/views/home/home'
Vue.use(Router)

export default new Router({
  routes: [
  {
    path: '/home', //首页城市选择
    name: "home",
    component(resolve) {
      require.ensure(['../views/home/home.vue'], () => {
        resolve(require('../views/home/home.vue'));
      });
    }
  },
  {
    path: '/msite', //外卖首页
    name: "msite",
    component(resolve) {
      require.ensure(['../views/msite/msite.vue'], () => {
        resolve(require('../views/msite/msite.vue'));
      });
    }
  },
  {
    path: '/shop', //商铺商品
    name: "shop",
    component(resolve) {
      require.ensure(['../views/shop/shop.vue'], () => {
        resolve(require('../views/shop/shop.vue'));
      });
    },
    redirect:'/shop/shopview',
    children: [{
        path: '/shop/ratingview', //商铺详情页
        name: "ratingview",
        component(resolve) {
          // require.ensure(['../views/shop/ratingView.vue'], () => {
          //   resolve(require('../views/shop/ratingview.vue'));
          // });
        },
    },{
        path: '/shop/shopview', //食品详情页
        name: "shopview",
        component(resolve) {
          require.ensure(['../views/shop/shopView.vue'], () => {
            resolve(require('../views/shop/shopView.vue'));
          });
        },
    },]
  },
  {
    path: '/', //首页
    redirect: '/home',
    component(resolve) {
      require.ensure(['../views/msite/msite.vue'], () => {
        resolve(require('../views/msite/msite.vue'));
      });
    }
  },
  ]
})
